<extend name="Base/base"/>
<block name="content">
<div id="content" class="clearfix">
	<div class="main">
		<section class="breadcrumb">
			<a href="__CONTROLLER__/index">首页</a>
			<i>></i>
			<span>{$info.shopname}</span>
		</section>
		<section class="basicinfo">
			<div class="b-img fl">
			<img width="198" height="120"  src="__PUBLIC__/Uploads/s_{$info.door_pic}"/>
			</div>
		<div class="b-info fl">
			<div class="one-line">
				<h2>{$info.shopname}</h2>
				<span>美食美客专送</span>
			</div>
			<div class="all-show">
				<h2>{$info.shopname}</h2>
				<span>美食美客专送</span>
			</div>
			<span class="cert-icon"><img src="__PUBLIC__/images/certificated_s.png"/></span>
			<dl>
				<dt>餐饮</dt>
				<dd class="rate-con">
					<span class="rate">
						<span class="rate-inner" style="width:{$info.avgscorePx}px"></span>
					</span>
					{$info.avgscore}分
				</dd>
			</dl>
			<dl>
				<dt><i class="icon icon-time"></i>接单时间:&nbsp;</dt>
				<dd class="bussinessStatus">
				<span>09:00-21:30</span>
				<strong class="doing">营业中</strong>
				</dd>
			</dl>
			<dl>
				<dt><i class="icon icon-address"></i>商户地址:&nbsp;</dt>
				<dd>
				{$info.detail_add}
				</dd>
			</dl>
			<div class="overall">
				<h3 class="title">总体评分</h3>
				<div class="rate-info">
					<div class="rate-num">{$info.avgscore}</div>
					<p class="pos">
						<span class="rate">
							<span class="rate-inner" style="width:{$info.avgscorePx}px"></span>
						</span>
					</p>
					<p>
						<span>共{$info.count}条评价</span>
					</p>
				</div>
				<table class="rate-table">
				<tr>
					<td width="30px">5分</td>
					<td width="150px">
						<span class="pnum">
							<span class="pnum-inner" style="width:{$info.5px}px"></span>
						</span>
					</td>
					<td>{$info.5fen}人</td>
				</tr>
				<tr>
					<td>4分</td>
					<td>
						<span class="pnum">
							<span class="pnum-inner" style="width:{$info.4px}px"></span>
						</span>
					</td>
					<td>{$info.4fen}人</td>
				</tr>
				<tr>
					<td>3分</td>
					<td>
						<span class="pnum">
							<span class="pnum-inner" style="width:{$info.3px}px"></span>
						</span>
					</td>
					<td>{$info.3fen}人</td>
				</tr>
				<tr>
					<td>2分</td>
						<td>
							<span class="pnum">
								<span class="pnum-inner" style="width:{$info.2px}px"></span>
							</span>
						</td>
					<td>{$info.2fen}人</td>
				</tr>
				<tr>
					<td>1分</td>
					<td>
						<span class="pnum">
							<span class="pnum-inner" style="width:{$info.1px}px"></span>
						</span>
					</td>
					<td>{$info.1fen}人</td>
				</tr>
			</table>
			</div>
		</div>
		<div class="b-cost fr">
			<div class="b-value">&#165;<strong class="b-num">3</strong></div>
			<p class="b-label">配送费</p>
		</div>
		<div class="b-divider fr"></div>
		<div class="b-price fr">
			<div class="b-value">&#165;<strong class="b-num">20</strong></div>
			<p class="b-label">起送价</p>
		</div>
		<div class="b-divider fr"></div>
		<div class="b-totime fr">
			<div class="b-value">
				<strong class="b-num">41分钟</strong>
				<span class="num-unit"></span>
			</div>
			<p class="b-label">平均送达时间</p>
		</div>
	</section>

	<div class="main-l">
		<div class="annouce">
			<span class="sound-icon"></span>
			<span>今日下单可选择今日-3.03配送</span>
		</div>
		<section class="menu-tab clearfix" >
			<ul>
				<li class="txt curr" id="menu"><a href="javascript:showMenu();">菜单</a></li>
				<li class="txt" id="comment"><a href="javascript:showComment();">评价</a></li>
				<li class="txt" id="zizhi"><a href="javascript:showZizhi();">资质</a></li>
			</ul>
		</section>
	<div class="menu">	
		 <section class="menu-filter-wrapper">
			<section class="menu-filter clearfix" >
				<div>
				<a class="filter-item" category_id="" href="javascript:void(0)" data=1>
				<span class="item-name" title="热销">&nbsp;&nbsp;&nbsp;热销&nbsp;&nbsp;&nbsp;</span>
				<em class="item-num"></em>
				</a>
				<foreach name="taglist" item="tag">
					<a class="filter-item" category_id="1863731068" href="javascript:void(0)" data=2>
						<span class="item-name" title="{$tag.tag}">&nbsp;&nbsp;&nbsp;{$tag.tag}&nbsp;&nbsp;&nbsp;</span>
						<em class="item-num">(17)</em>
					</a>
				</foreach>				
			</div>
			<div class="bottomArr" data-node="bottomArr"></div>
			</section>
		</section> 
		<section class="menu-list">
			<div class="list-wrap" id="menu_1" >
				<div class="list-status">
					<span class="title">{$menu.tag2}</span>
				</div>
				<div class="list clearfix">
					<ul>
						<foreach name="menulist" item="menu">
							<li class="list-item" data="{$menu.menu}" data-sid="item_1863749890"   orderlimit=""  >
								<figure class="headimg fl">
									<div class="bg-img" style="background: url(__PUBLIC__/images/shopcard_loading.png) center center no-repeat;background-size:cover;-webkit-background-size:cover;-o-background-size:cover;-moz-background-size:cover;-ms-background-size:cover;">	<img src="__PUBLIC__/Uploads/s_{$menu.menu_pic}" width="120" height="120"/>
									</div>
								</figure>
							<div class="info fl">
								<h3 data-title="{$menu.menu}" data-content="温馨提示：图片仅供参考，请以实物为准；高峰时段及恶劣天气，请提前下单。">{$menu.menu}</h3>
								<div class="info-desc">
									<p class="m-hot-value">
										<!-- <span class="sales-count">27人推荐</span><span class="divider"></span> -->
										<span class="sales-count">已售{$menu.num}份</span>
									</p>
									<p class="m-hot-value">
									</p>
								</div>
								<div class="m-price"><strong>&#165;{$menu.price}</strong></div>
							</div>
							<div class="m-sel-icon" unselectable="on">
								<div class="select-con">
									<a herf="javascript:doMinus({$menu.id});">
										<strong class="minusfrcart{$menu.id} minusfrcart" data-node="minusfrcart">
											<!-- <img src="__PUBLIC__/images/icon_min_big_d2efc70.png"/> -->
										</strong>
									</a>
									<strong class="select_count{$menu.id} select_count"></strong>
									<a href="javascript:;" onclick="doAdd({$menu.id})">
										<strong class="addtocart{$menu.id} addtocart dishSelectElem" data-node="addtocart">
											<img title="加入购物车" src="__PUBLIC__/images/icon_add_big_a2d16d3.png">
										</strong>
									</a>
								</div>
							</div>
							</li>
						</foreach>
					</ul> 
				</div>
			</div>
		</section>
	</div>
	<div class="comment" style="display: none;">
		<ul>
			<foreach name="commentlist" item="comment">
				<li style="border-bottom:2px solid #ddd;font-size: 14px;margin-top:10px;">
					<div style="height:30px;color:#9999A5;">
						<span>{$comment.username}</span>&nbsp;&nbsp;&nbsp;&nbsp;
						<span>
							<span class="rate-con">
								<span class="rate">
									<span class="rate-inner" style="width:{$comment.scorePX}px"></span>
								</span>
							{$comment.score}分
							</span>
						</span>&nbsp;&nbsp;&nbsp;&nbsp;
						<span>送餐时间</span>
						<span style="float: right">{$comment.addtime}</span>
					</div>
					<div style="margin-bottom: 10px;">
						<b>
							<p style="margin-top:10px;line-height: 40px;">{$comment.shop_content}<br/>{$comment.deli_content}</p>
						</b>
					</div>
				</li>
			</foreach>
		</ul>
	</div>
	<div class="zizhi" style="display: none;">
		<section class="cert-list" id="cert-list">
			<div class="comment-con" data-node="commCon">
				<div class="cert-section without-safety">
				<div class="title">商家从业资质照片</div>
				<div data-node="imgList" class="img-list">
					<img src="__PUBLIC__/Uploads/s_{$info.info_pic}" height="140" width="230">
				</div>
				</div>
				<div class="cert-section">
					<div class="title">商家实景照片</div>
					<div data-node="imgList" class="img-list">
					<img src="__PUBLIC__/Uploads/s_{$info.door_pic}" height="140" width="230">
					<img src="__PUBLIC__/Uploads/s_{$info.env_pic}" height="140" width="230">
					</div>
				</div>
				<div class="btm-section">
					我们竭诚为您打造有品质的外卖，如商户资质存在问题，请
					<span class="red-text" data-node="jubao">举报</span>
				</div>
			</div>
		</section>
	</div>
</div>
	
		<div class="side">
			<div class="menu">
				<!--收藏-->
				<section class="menu-collect clearfix" id="widget-menu-collect" >			
					<if condition="$collectinfo eq null">
						<div id="collectX" onclick="collectX({$info.id})" class="collect-btn" data-node="collectBtn" from="menu">
							<i class="collectX"></i>
							<span data-node="collectTxt">收藏该店</span>
						</div>
					<else/>
						<div id="qxCollect" onclick="qxCollect({$info.id})" class="collect-btn" data-node="collectBtn" from="menu">
							<i class="qxCollect" style="background:url(__PUBLIC__/images/icon_collect_7e5060e.png) 0px 20px"></i>
							<span data-node="collectTxt">取消收藏</span>
						</div>
					</if>	
				</section>
				<!--收藏-->
				<section id="shop-notice" class="notice clearfix">
					<p class="warp"></p>
						<h2>商家公告</h2>
					<p  class="notice-desc" data-node="shop-notice"></p>
					<textarea data-node="hiddenText" style="display:none">							本店欢迎您下单，用餐高峰请提前下单，谢谢！
					</textarea>
				</section>
				<section  class="notice-float" style="display:none">
					<p class="warp"></p>
					<h2>商家公告</h2>
					<p  class="notice-desc" data-node="shop-notice-2"></p>
				</section>
				<div class="map">
					<div id="MapHolder" class="mapHolder" ></div>
					<div id="mapLoading"><img src="images/loading_50c5e3e.gif"></div>
				</div>
				<section node-data="sourceinfo" class="sourceinfo">
					<div>
						<i class="icon_car"></i>
						<p class="icon_info">配送服务由<span>&nbsp;美食美客&nbsp;</span>提供</p>
					</div>
					<p class="icon_text">高品质外卖服务</p>
				</section>
				<section id="fill_diff-section" state="non-trigger">
					<div id="fill_diff_bear" status='left'></div>
					<div id="fill_diff_table"></div>
				</section>
				<!--购物车-->
				<section class="cart-section cart-fix" id="cart-section">
				<div class="menu-cart menu-cart-box-shadow">
					
					<div class="cc-warp">
						<div class="title">
							<span class="txt">购物车</span>
						<span class="clear-cart" onclick="doClear({$info.id})">清空</span>
						</div>
						<div class="cart-panel">
							<table id="tid">
								<thead class="cart-head">
									<tr>
										<td class="item-name">菜品</td>
										<td class="item-count">份数</td>
										<td class="item-price">单价</td>
										<td class="item-delete"></td>
									</tr>
								</thead>
								<tbody class="item-list" data-node="item-list">
									<foreach name="cartlist" item="cart">
									<tr id="cartid{$cart.mid}">
										<td class="item-name">{$cart.menu}</td>
										<td class="item-count">
											<a herf="javascript:;" onclick="doMinus({$cart.mid})">
												<strong class="minusfrcart{$cart.mid} minusfrcart" >
												<img src="__PUBLIC__/images/icon_min_ab5887b.png" width="15px"/>
												</strong>
											</a>
											<strong id="menu{$cart.mid}" class="select_count{$cart.mid}" >	
												{$cart.num}
											</strong>
											<a href="javascript:;" onclick="doAdd({$cart.mid})">
												<strong class="addtocart{$cart.mid} addtocart dishSelectElem">
													<img src="__PUBLIC__/images/icon_add_f486403.png" width="15px"/>
												</strong>
											</a>
										</td>
										<td class="item-price">
											<span class="activityprice"><strong>&#165;{$cart.price}
										</td>
										<td class="item-delete"></td>
									</tr>
									</foreach>
								</tbody>
							</table>
						</div>
					</div>
					<div class="cart-bar">
						<span class="cart-logo fl"></span>
						<span class="cart-desc "  id="cartIsEmpty">
							<if condition="$sum eq 0">
								购物车为空
								<else/>
								共计
								<span id="sum">{$sum}</span>元
							</if>
						</span>
						<!-- <span class="cart-desc fl" id="cartAmout" style="display: none;"></span> -->
						<span class="pay"> 
						<if condition="$sum lt 20">
							<span class="cart-desc cart-cha fr"  id="cartCha">
								还差&#165;{$cha}元起送
							</span>
						<else />
							<a href="__MODULE__/Pay/index/sid/{$info.id}">
								<span class="cart-desc submit fr" id="cartSubmit">选好了</span>
							</a>
						</if>
						</span>
					</div>
				</div>
				</section>
				<!--购物车-->
			</div>
			<div class="comment" style="display: none;">

				<section class="comside">
					<div class="overall">
						<h2 class="title">总体评分</h2>
						<div class="rate-info">
							<div class="rate-num">{$info.avgscore}</div>
							<p class="pos">
								<span class="rate">
									<span class="rate-inner" style="width:{$info.avgscorePx}px"></span>
								</span>
							</p>
							<p>
								<span>共{$info.count}条评价</span>
							</p>
						</div>
						<table class="rate-table">
							<tr>
								<td width="30px">5分</td>
								<td width="150px">
									<span class="pnum">
										<span class="pnum-inner" style="width:{$info.5px}px"></span>
									</span>
								</td>
								<td>{$info.5fen}人</td>
							</tr>
							<tr>
								<td>4分</td>
								<td>
									<span class="pnum">
										<span class="pnum-inner" style="width:{$info.4px}px"></span>
									</span>
								</td>
								<td>{$info.4fen}人</td>
							</tr>
							<tr>
								<td>3分</td>
								<td>
									<span class="pnum">
										<span class="pnum-inner" style="width:{$info.3px}px"></span>
									</span>
								</td>
								<td>{$info.3fen}人</td>
							</tr>
							<tr>
								<td>2分</td>
									<td>
										<span class="pnum">
											<span class="pnum-inner" style="width:{$info.2px}px"></span>
										</span>
									</td>
								<td>{$info.2fen}人</td>
							</tr>
							<tr>
								<td>1分</td>
								<td>
									<span class="pnum">
										<span class="pnum-inner" style="width:{$info.1px}px"></span>
									</span>
								</td>
								<td>{$info.1fen}人</td>
							</tr>
						</table>
					</div>
				</section>
			</div>
		</div>
	</div>


	
	<input type="hidden" id="bdstoken" name="bdstoken" value="5ffe1e1101edcc65b9f9bf5bd716c0c4">
	<input type="hidden" id="bindstoken" name="bindstoken" value="">
</div>
	<div id="hover-overlay" class="hover-overlay"></div>
	


</block>
<block name="myscript">
	<script type="text/javascript">
	//购物车详细信息的显示与隐藏
		$("#cartIsEmpty").click(function(){
			$(".cc-warp").toggle();
		});

	//添加购物车（+1）
	function doAdd(id){
		$.ajax({
			type:'POST',
			url:'__CONTROLLER__/addCart',
			data:'mid='+id,
			dataType:'json',
			success:function(res){
				if(res.b){
					switch(res.b){
						case 1:
							if(res.num==1){
								var str = "<tr id='cartid"+res.mid+"'>";
								str  +=	"<td class='item-name'>"+res.menu+"</td>";
								str +=	"<td class='item-count'><a herf='javascript:;' onclick='doMinus("+res.mid+")'>" +
										"<strong class='minusfrcart"+res.mid+" minusfrcart' >" +
										"<img src='__PUBLIC__/images/icon_min_ab5887b.png' width='15px'/></strong>" +
										"</a>&nbsp;<strong id='menu"+res.mid+"' class='select_count"+res.mid+"' >"+res.num+"</strong>" +
										"&nbsp;<a href='javascript:;' onclick='doAdd("+res.mid+")'>" +
										"<strong class='addtocart"+res.mid+" addtocart dishSelectElem'>" +
										"<img src='__PUBLIC__/images/icon_add_f486403.png' width='15px'/>" +
										"</strong></a></td>";
								str +=	"<td class='item-price'><span class='activityprice'>" +
										"<strong>&#165;"+res.price+"</td><td class='item-delete'></td></tr>";

							$(str).appendTo("#tid tbody");
							}else{
								$("#menu"+res.mid).html(res.num);
							}
							break;
						case 2:
							var str = "<tr id='cartid"+res.mid+"'>";
							str  +=	"<td class='item-name'>"+res.menu+"</td>";
								str +=	"<td class='item-count'>" +
										"<a herf='javascript:;' onclick='doMinus("+res.mid+")'>" +
										"<strong class='minusfrcart"+res.mid+" minusfrcart' >" +
										"<img src='__PUBLIC__/images/icon_min_ab5887b.png' width='15px'/>" +
										"</strong></a><strong id='menu"+res.mid+"' class='select_count"+res.mid+"' >"+res.num+"</strong>" +
										"<a href='javascript:;' onclick='doAdd("+res.mid+")'>" +
										"<strong class='addtocart"+res.mid+" addtocart dishSelectElem'>" +
										"<img src='__PUBLIC__/images/icon_add_f486403.png' width='15px'/>" +
										"</strong></a></td>";
								str +=	"<td class='item-price'><span class='activityprice'>" +
										"<strong>&#165;"+res.price+"</td><td class='item-delete'></td></tr>";

							$(str).appendTo("#tid tbody");
							break;
					}

					 if(isNaN(parseInt($("#sum").html()))){
						var sum = parseInt(res.price);
					}else{
						var sum = (parseInt(res.price)+parseInt($("#sum").html()));
					}
					
					$("#cartIsEmpty").html("共计<span id='sum'>"+sum+"</span>元");
					if(sum >= 20){
						$(".pay").html("<a href='__MODULE__/Pay/index/sid/"+res.sid+"'><span class='cart-desc submit fr' id='cartSubmit'  style='display:block;'>选好了</span></a>");
					}else{
						var cha = 20-sum;
						$(".pay").html("<span class='cart-desc cart-cha fr'  id='cartCha'>还差&#165;"+cha+"元起送</span>");
					}
				}else{
					alert("购物车添加失败，请重试！");
				}
		
			}
		});
	}

	//购物车减一
	function doMinus(id){
		$.ajax({
			type:'POST',
			url:'__CONTROLLER__/minusCart',
			//url:'__MODULE__/Cart/minusCart',
			data:'mid='+id,
			dataType:'json',
			success:function(res){
				if(res.num>0){
					$("#menu"+res.mid).html(res.num);
					var sum = parseInt($("#sum").html())-parseInt(res.price);
					$("#sum").html(sum);
					if(sum<20){
							var cha = 20-sum;
							$(".pay").html("<span class='cart-desc cart-cha fr'  id='cartCha'>还差&#165;"+cha+"元起送</span>");
						}
				}else{
					$("#cartid"+res.mid).remove();
					var sum = parseInt($("#sum").html())-parseInt(res.price);
					if(sum>0){
						$("#sum").html(sum);	
					}else{
						$("#cartIsEmpty").html("购物车为空");
						$(".pay").hide();
					}
				}
			}
		});
	}

	//清空购物车
	function doClear(id){
		$.ajax({
          type:"POST",
          url: "__CONTROLLER__/doClear",
          //url: "__MODULE__/Cart/doClear",
          data:"sid="+id,
          dataType:"json",
          success:function(res){
            if(res.b){
               $("#tid tbody tr").remove();
               $("#cartIsEmpty").html("购物车为空");
               $(".pay").hide();
            }else{
              alert("清空购物车失败！");
            }
          }
       });
	}

	//收藏店铺
	function collectX(id){	
		$.ajax({
			type:"POST",
			url: "__CONTROLLER__/addCollect",
			data:"sid="+id,
			dataType:"json",
			success:function(res){
				if(res){
					$("#widget-menu-collect").html("<div id='qxCollect' onclick='qxCollect("+res.sid+")' class='collect-btn' data-node='collectBtn' from='menu'><i class='qxCollect' style='background:url(__PUBLIC__/images/icon_collect_7e5060e.png) 0px 20px'></i><span data-node='collectTxt'>取消收藏</span></div>");
				}
			}
		});
	}

	//取消收藏该店铺
	function qxCollect(id){
		$.ajax({
			type:"POST",
			url: "__CONTROLLER__/delCollect",
			data:"sid="+id,
			dataType:"json",
			success:function(res){
				if(res){
					$("#widget-menu-collect").html("<div id='collectX' onclick='collectX({$info.id})' class='collect-btn' data-node='collectBtn' from='menu'><i class='collectX'></i><span data-node='collectTxt'>收藏该店</span></div>");
				}
			}
		});
	}

	//查看菜单信息
	function showMenu(){
		if($("#comment").hasClass("curr")){
			$("#comment").removeClass("curr");
		}
		if($("#zizhi").hasClass("curr")){
			$("#zizhi").removeClass("curr");
		}
		if($(".comment").show()){
			$(".comment").hide();
		}
		if($(".zizhi").show()){
			$(".zizhi").hide();
		}
		$(".menu").show();	
		$("#menu").addClass("curr");	
	}

	//查看评论信息
	function showComment(){
		
		if($("#menu").hasClass("curr")){
			$("#menu").removeClass("curr");
		}
		if($("#zizhi").hasClass("curr")){
			$("#zizhi").removeClass("curr");
		}

		if($(".menu").show()){
			$(".menu").hide();
		}

		if($(".zizhi").show()){
			$(".zizhi").hide();
		}

		$("#comment").addClass("curr");	
		$(".comment").show();
	}

	//查看资质信息
	function showZizhi(){
		
		if($("#menu").hasClass("curr")){
			$("#menu").removeClass("curr");
		}
		if($("#comment").hasClass("curr")){
			$("#comment").removeClass("curr");
		}
		if($(".comment").show()){
			$(".comment").hide();
		}
		if($(".menu").show()){
			$(".menu").hide();
		}
		$("#zizhi").addClass("curr");
		$(".zizhi").show();
	}
	</script>
</block>